package com.lmabbe.tenant.objects.converter;

import com.lmabbe.tenant.objects.dto.OauthClientDTO;
import com.lmabbe.tenant.objects.entity.OauthClient;
import com.lmabbe.tenant.objects.vo.OauthClientVO;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;

import java.util.List;

/**
 * 认证客户端 转换器
 *
 * @author lmabbe
 */
@Mapper(componentModel = "spring")
public interface OauthClientConverter {
    /**
     * dto转实体
     *
     * @param to
     * @return
     */
    OauthClient dto2Entity(OauthClientDTO to);

    /**
     * dto转实体
     *
     * @param to
     * @return
     */
    @Mapping(target = "clientId", source = "clientId")
    OauthClient dto2Entity(OauthClientDTO to, Long clientId);

    /**
     * 数据列表转Vo列表
     *
     * @param list
     * @return
     */
    List<OauthClientVO> list2Vos(List<OauthClient> list);

    /**
     * 实体转VO
     *
     * @param entity
     * @return
     */
    OauthClientVO entity2Vo(OauthClient entity);
}